/* 
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */


#ifndef WISHMASTER_FILTERLIST_H
#define WISHMASTER_FILTERLIST_H

#include <QList>
#include <QString>
#include <QSharedPointer>
#include "filter.h"

namespace Wishmaster
{
	class FilterList
	{
	public:
		FilterList();
		virtual ~FilterList();

		QStringList save();
		void load(const QStringList& list);
		bool check(const PostPtr& post);
		bool checkText(const QString& text);

		FilterPtr filter(int index);
		void deleteFilter(int index);
		QStringList listFilters();

		void addTextFilter(const QString& name, const QString& pattern, bool cis = false);

		void addPrototype(FilterPtr proto);
	private:
		QList<FilterPtr> m_filters;
		QMap<QString, FilterPtr> m_prototypes;
	};

	typedef QSharedPointer<FilterList> FilterListPtr;
}

#endif

